#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<functional>
using namespace std;
//int del,path=0,ret=INT_MAX,index;
//int n, m;
//vector<bool> visited;
//void dfs(int i, vector<vector<int>>& graph, vector<int>& initial)
//{
//	path++;
//	visited[i] = true;
//	for (int j = 0; j < n; j++)
//	{
//		if (graph[i][j] == 1 && visited[j]==false)
//			dfs(j, graph, initial);
//	}
//}
//int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {
//	n = graph.size(),m=initial.size();
//	for (auto& e : initial)
//	{
//		visited.clear();
//		visited.resize(n, false);
//		path = 0;
//		del = e;
//		for (int i = 0; i < m; i++)
//		{
//			if (del == initial[i])
//				continue;
//			if (visited[initial[i]] == false)
//				dfs(initial[i],graph,initial);
//		}
//		if (path <= ret)
//		{
//			ret = path;
//			if(index > e)
//			index = e;
//		}
//	}
//	return index;
//}
//int Distance(int x1, int y1, int x2, int y2)
//{
//	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
//}
//int maximumDetonation(vector<vector<int>>& bombs) 
//{
//	vector<vector<int>> graph;
//	int n = bombs.size();
//	graph.resize(n);
//	for (int i = 0; i < n; i++)
//	{
//		for (int j = i + 1; j < n; j++)
//		{
//			if (Distance(bombs[i][0], bombs[i][1], bombs[j][0], bombs[j][0]) < bombs[i][2] + bombs[j][2])
//			{
//				graph[i].push_back(j);
//				graph[j].push_back(i);
//			}
//		}
//	}
//	int path = 0, ret = 0;
//	vector<bool> visited(n,false);
//	function<void(int)> dfs = [&](int x)
//	{
//		visited[x] = true;
//		path++;
//		for (auto& e : graph[x])
//		{
//			if (visited[e] == false)
//				dfs(e);
//		}
//	};
//	for (int i = 0; i < n; i++)
//	{
//		path = 0;
//		visited.clear();
//		visited.resize(n, false);
//		dfs(i);
//		ret = max(ret, path);
//	}
//	return ret;
//}
int path = 0, ret = 0;
vector<vector<int>> graph;
vector<bool> visited;
void dfs(int x)
{
	visited[x] = true;
	path++;
	for (auto& e : graph[x])
	{
		if (visited[e] == false)
			dfs(e);
	}
}
int Distance(int x1, int y1, int x2, int y2)
{
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
int maximumDetonation(vector<vector<int>>& bombs)
{
	int n = bombs.size();
	graph.resize(n);
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (i == j) continue;
			if (Distance(bombs[i][0], bombs[i][1], bombs[j][0], bombs[j][1]) <= bombs[i][2])
				graph[i].push_back(j);
			if (Distance(bombs[i][0], bombs[i][1], bombs[j][0], bombs[j][1]) <= bombs[j][2])
				graph[j].push_back(i);
		}
	}
	visited.resize(n, false);
	for (int i = 0; i < n; i++)
	{
		path = 0;
		visited.clear();
		visited.resize(n, false);
		dfs(i);
		ret = max(ret, path);
	}
	return ret;
}
vector<vector<string>> accountsMerge(vector<vector<string>>& accounts) {

}
int main()
{
	//vector<vector<int>> graph = { {1,1,0},{1,1,0}, {0,0,1} };
	//vector<int> initial = { 0,1,2 };
	//minMalwareSpread(graph, initial);
	vector<vector<int>>  bombs = { {2,1,3},{6,1,4}};
	maximumDetonation(bombs);

	return 0;
}